﻿rem
	####################################################################
	
	BlitzOgre3D // Ogre3D for BlitzMax and Blitz3D
	
	####################################################################
endrem
SuperStrict

rem
bbdoc: SEDM.bo3d
endrem
Module sedm.bo3d

ModuleInfo "Name: sedm.bo3d"
ModuleInfo "Description: Ogre3D based 3D Engine for BlitzMax"
ModuleInfo "Licence: Ogre3D Engine License"
ModuleInfo "Author: Jens [bruZard] Henschel"

Import brl.linkedlist
Import brl.filesystem
Import sedm.std

Import "bo3d.lib"

?Win32
Extern "win32"
	' root functions
	Function o_newRoot:Byte ptr(plugins:Byte ptr, config:Byte ptr, logfile:Byte ptr, manual:Byte)
	Function o_restoreConfig:Byte(ogre_root:Byte ptr)
	Function o_showConfigDialog:Byte(ogre_root:Byte ptr)
	Function o_initialise:Byte ptr(ogre_root:Byte ptr, autoCreateWindow:Byte, windowTitle:Byte ptr, customCababilities:Byte ptr)
	Function o_freeRoot(ogre_root:Byte ptr)
	Function o_saveConfig(ogre_root:Byte ptr)
	Function o_getRenderSystemByName:Byte ptr(ogre_root:Byte ptr, rendersystem_name:Byte ptr)
	Function o_setRenderSystem(ogre_root:Byte ptr, rs:Byte ptr)
	Function o_getRenderSystem:Byte ptr(ogre_root:Byte ptr)
	Function o_createRenderWindow:Byte ptr(ogre_root:Byte ptr, name:Byte ptr, width:Int, Height:Int, fullscreen:Byte, miscParams:Byte ptr)
	Function o_createSceneManager:Byte ptr(ogre_root:Byte ptr, typeMask:Int, instanceName:Byte ptr)
	Function o_renderOneFrame:Byte(ogre_root:Byte ptr, timeSinceLastFrame:Float)
	Function o_loadPlugin(ogre_root:Byte ptr, plugin:Byte ptr)
	Function o_addFrameListener(ogre_root:Byte ptr, listener:Byte ptr)
	
	' rendersystem functions
	Function o_setConfigOption(rs:Byte ptr, cname:Byte ptr, cvalue:Byte ptr)
	
	' scenemanager functions
	Function o_createCamera:Byte ptr(scm:Byte ptr, name:Byte ptr)
	Function o_createEntity:Byte ptr(scm:Byte ptr, entityName:Byte ptr, meshName:Byte ptr, groupName:Byte ptr)
	Function o_getRootSceneNode:Byte ptr(scm:Byte ptr)
	Function o_createLight:Byte ptr(scm:Byte ptr)
	Function o_setAmbientLight(scm:Byte ptr, col:Byte ptr)
	Function o_destroyCamera(scm:Byte ptr, cam:Byte ptr)
	Function o_destroyAllCameras(scm:Byte ptr)
	Function o_destroyLight(scm:Byte ptr, l:Byte ptr)
	Function o_destroyAllLights(scm:Byte ptr)
	Function o_destroySceneNode(scm:Byte ptr, node:Byte ptr)
	Function o_destroyEntity(scm:Byte ptr, ent:Byte ptr)
	Function o_destroyAllEntities(scm:Byte ptr)
	Function o_setShadowTechnique(scm:Byte ptr, technique:Int)
	Function o_setShadowTextureSize(scm:Byte ptr, texsize:Int)
	Function o_setShadowUseLightClipPlanes(scm:Byte ptr, enable:Byte)
	Function o_sm_setShadowFarDistance(scm:Byte ptr, distance:Float)
	Function o_setSkyBox(scm:Byte ptr, enable:Byte, materialName:Byte ptr, distance:Float, drawFirst:Byte, orientation:Byte ptr, groupName:Byte ptr)
	Function o_createRayQuery:Byte ptr(scm:Byte ptr, r:Byte ptr, Mask:Int)
	Function o_destroyQuery(scm:Byte ptr, rsq:Byte ptr)
	
	' renderwindow functions
	Function o_addViewPort:Byte ptr(win:Byte ptr, camera:Byte ptr, zOrder:Int, x:Float, y:Float, width:Float, Height:Float)
	Function o_getAverageFPS:Float(win:Byte ptr)	
	Function o_getBestFPS:Float(win:Byte ptr)
	Function o_getBestFrameTime:Float(win:Byte ptr)
	Function o_getLastFPS:Float(win:Byte ptr)
	Function o_getWorstFPS:Float(win:Byte ptr)
	Function o_getWorstFrameTime:Float(win:Byte ptr)
	
	' viewport functions
	Function o_setBackgroundColour(viewport:Byte ptr, r:Float, g:Float, b:Float, a:Float)
	Function o_getActualWidth:Int(viewport:Byte ptr)
	Function o_getActualHeight:Int(viewport:Byte ptr)
	Function o_setCamera(viewport:Byte ptr, camera:Byte ptr)
	
	' resourcegroupmanager functions
	Function o_addResourceLocation(dir:Byte ptr, locType:Byte ptr, resGroup:Byte ptr, recursive:Byte)
	Function o_createResourceGroup(name:Byte ptr, inGlobalPool:Byte)
	Function o_initialiseResourceGroup(resourceGroup:Byte ptr)
	
	' camera functions
	Function o_camera_setPosition(cam:Byte ptr, x:Float, y:Float, z:Float)
	Function o_setAspectRatio(cam:Byte ptr, ratio:Float)
	Function o_camera_moveRelative(cam:Byte ptr, vec3:Byte ptr)
	Function o_setNearClipDistance(cam:Byte ptr, nearClipDistance:Float)
	Function o_setFarClipDistance(cam:Byte ptr, farClipDistance:Float)
	Function o_camera_pitch(cam:Byte ptr, pitch:Float)
	Function o_camera_yaw(cam:Byte ptr, yaw:Float)
	Function o_camera_roll(cam:Byte ptr, roll:Float)
	Function o_camera_getPosition:Byte ptr(cam:Byte ptr)
	Function o_camera_getViewPort:Byte ptr(cam:Byte ptr)
	
	' scenenode functions
	Function o_createChildSceneNode:Byte ptr(scenenode:Byte ptr, entityName:Byte ptr, translate:Byte ptr, rotate:Byte ptr)
	Function o_attachObject(scenenode:Byte ptr, obj:Byte ptr)
	Function o_getName$z(obj:Byte ptr)
	Function o_getType$z(obj:Byte ptr)
	Function o_scenenode_pitch(node:Byte ptr, angle:Float, relativeTo:Int)
	Function o_scenenode_yaw(node:Byte ptr, angle:Float, relativeTo:Int)
	Function o_scenenode_roll(node:Byte ptr, angle:Float, relativeTo:Int)
	Function o_scenenode_translate(node:Byte ptr, x:Float, y:Float, z:Float, relativeTo:Int)
	Function o_scenenode_setposition(node:Byte ptr, x:Float, y:Float, z:Float)
	Function o_scenenode_getposition:Byte ptr(node:Byte Ptr)
	Function o_scenenode_setOrientation(node:Byte ptr, orientation:Byte ptr)
	
	' entity functions
	Function o_entity_getParentSceneNode:Byte ptr(ent:Byte ptr)
	Function o_entity_setCastShadows(ent:Byte ptr, enable:Byte)
	Function o_clone:Byte ptr(ent:Byte ptr, newName:Byte ptr)
	Function o_entity_setMaterialName(ent:Byte ptr, matName:Byte ptr, resGroup:Byte ptr)
	Function o_entity_setMaterial(ent:Byte ptr, mat:Byte ptr)
	Function o_entity_getMaterial:Byte ptr(ent:Byte ptr, subEntity:Int)
	Function o_entity_getMesh:Byte ptr(ent:Byte ptr)
	
	' light functions
	Function o_light_setType(l:Byte ptr, lightType:Int)
	Function o_light_setPosition(l:Byte ptr, x:Float, y:Float, z:Float)
	Function o_light_setDiffuseColour(l:Byte ptr, r:Float, g:Float, b:Float)
	Function o_light_setSpecularColour(l:Byte ptr, r:Float, g:Float, b:Float)
	Function o_light_getDiffuseColour:Byte ptr(l:Byte ptr)
	Function o_light_getSpecularColour:Byte ptr(l:Byte ptr)
	Function o_light_setAttenuation(l:Byte ptr, rng:Float, constant:Float, linear:Float, quadratic:Float)
	Function o_light_getAttenuationRange:Float(l:Byte ptr)
	Function o_light_getAttenuationConstant:Float(l:Byte ptr)
	Function o_light_getAttenuationLinear:Float(l:Byte ptr)
	Function o_light_getAttenuationQuadric:Float(l:Byte ptr)
	Function o_light_getPosition:Byte ptr(l:Byte ptr)
	Function o_light_setDirection(l:Byte ptr, x:Float, y:Float, z:Float)
	Function o_setSpotlightRange(l:Byte ptr, innerAngle:Float, outerAngle:Float, falloff:Float)
	Function o_setSpotlightInnerAngle(l:Byte ptr, angle:Float)
	Function o_setSpotlightOuterAngle(l:Byte ptr, angle:Float)
	Function o_setSpotlightFalloff(l:Byte ptr, falloff:Float)
	Function o_getSpotlightInnerAngle:Float(l:Byte ptr)
	Function o_getSpotlightOuterAngle:Float(l:Byte ptr)
	Function o_getSpotlightFalloff:Float(l:Byte ptr)
	Function o_light_getDirection:Byte ptr(l:Byte ptr)
	Function o_light_setPowerScale(l:Byte ptr, power:Float)
	Function o_light_getPowerScale:Float(l:Byte ptr)
	Function o_light_getMovableType$z(l:Byte ptr)
	Function o_light_setVisible(l:Byte ptr, visible:Byte)
	Function o_light_setShadowFarDistance(l:Byte ptr, distance:Float)
	Function o_light_setShadowFarClipDistance(l:Byte ptr, farClip:Float)
	Function o_light_resetShadowFarDistance(l:Byte ptr)
	Function o_light_getShadowFarDistance:Float(l:Byte ptr)
	Function o_light_setShadowNearClipDistance(l:Byte ptr, nearClip:Float)
	Function o_light_getShadowNearClipDistance:Float(l:Byte ptr)
	Function o_light_getShadowFarClipDistance:Float(l:Byte ptr)
	Function o_light_getName$z(l:Byte ptr)
	Function o_light_getParentNode:Byte ptr(l:Byte ptr)
	Function o_light_getParentSceneNode:Byte ptr(l:Byte ptr)
	Function o_light_setCastShadows(l:Byte ptr, enable:Byte)
	
	' LogManager
	Function o_logMessage(message:Byte ptr, logMessageLevel:Int, maskDebug:Byte)

	' MaterialManager
	Function o_material_Create:Byte ptr(matName:Byte ptr, group:Byte ptr, isManual:Byte, loader:Byte ptr, createParams:Byte ptr)
	Function o_material_getByName:Byte ptr(matName:Byte ptr)
	
	' Material
	Function o_material_clone:Byte ptr(mat:Byte ptr, newName:Byte ptr, changeGroup:Byte, newGroup:Byte ptr)
	Function o_material_setDiffuse(mat:Byte ptr, r:Float, g:Float, b:Float, a:Float)
	function o_material_setShininess(mat:Byte ptr, shininess:Float)
	Function o_material_setAmbient(mat:Byte ptr, r:Float, g:Float, b:Float)
	Function o_material_setSpecular(mat:Byte ptr, r:Float, g:Float, b:Float, a:Float)
	Function o_material_setSelfIllumination(mat:Byte ptr, r:Float, g:Float, b:Float)
	Function o_material_setPointSize(mat:Byte ptr, ps:Float)
	Function o_material_setReceiveShadows(mat:Byte ptr,enabled:Byte)
	Function o_material_compile(mat:Byte ptr, autoManageTextureUnits:Byte)
	Function o_material_setDepthCheckEnabled(mat:Byte ptr, enabled:Byte)
	Function o_material_setDepthWriteEnabled(mat:Byte ptr, enabled:Byte)
	Function o_material_setColourWriteEnabled(mat:Byte ptr, enabled:Byte)
	Function o_material_setCullingMode(mat:Byte ptr, mode:Int)
	Function o_material_setManualCullingMode(mat:Byte ptr, mode:Int)
	Function o_material_setLightingEnabled(mat:Byte ptr, enabled:Byte)
	Function o_material_setShadingMode(mat:Byte ptr, mode:Int)
	Function o_material_setFog(mat:Byte ptr, overrideScene:Byte, mode:Int, colour:Byte ptr, expDensity:Float, linearStart:Float, linearEnd:Float)
	Function o_material_setDepthBias(mat:Byte ptr, constantBias:Float, slopeScaleBias:Float)
	Function o_material_setTextureFiltering(mat:Byte ptr, filterType:Int)
	Function o_material_setTextureAnisotropy(mat:Byte ptr, maxAniso:Int)
	Function o_material_setSceneBlending(mat:Byte ptr, sbt:Int)
	Function o_material_getName$z(mat:Byte ptr)
	Function o_material_getTechnique:Byte ptr(mat:Byte ptr, index:Int)
	Function o_material_getTechniqueByName:Byte ptr(mat:Byte ptr, techname:Byte ptr)
	Function o_material_isTransparent:Byte(mat:Byte ptr)
	Function o_material_getReceiveShadows:Byte(mat:Byte ptr)
	Function o_material_setTransparencyCastsShadows(mat:Byte ptr, enabled:Byte)
	Function o_material_getTransparencyCastsShadows:Byte(mat:Byte ptr)
	Function o_material_createTechnique:Byte ptr(mat:Byte ptr)
	Function o_material_getNumTechniques:Int(mat:Byte ptr)
	Function o_material_removeTechnique(mat:Byte ptr, index:Int)
	Function o_material_removeAllTechniques(mat:Byte ptr)
	Function o_material_getSupportedTechnique:Byte ptr(mat:Byte ptr, index:Int)
	Function o_material_getNumSupportedTechniques:Int(mat:Byte ptr)
	Function o_material_getUnsupportedTechniquesExplanation$z(mat:Byte ptr)
	Function o_material_getNumLodLevels:Int(mat:Byte ptr, schemeIndex:Int)
	Function o_material_getBestTechnique:Byte ptr(mat:Byte ptr, lodIndex:Int, rend:Byte ptr)

	' Mesh Functions
	Function o_mesh_getBounds:Byte ptr(m:Byte ptr)

	' AxisAlignedBox Functions
	function o_aab_getSize:Byte ptr(aab:Byte ptr)

	' CompositorManager
	Function o_addCompositor:Byte ptr(vport:Byte ptr, compositor:Byte ptr, addPosition:Int)
	function o_setCompositorEnabled(vp:Byte ptr, compositor:Byte ptr, enabled:Byte)
	
	' Technique
	Function o_technique_getPass:Byte ptr(tech:Byte ptr, index:Int)
	Function o_technique_getPassByName:Byte ptr(tech:Byte ptr, techName:Byte ptr)
	
	' Pass
	Function o_pass_getFragmentProgramParameters:Byte ptr(p:Byte ptr)
	Function o_pass_processPendingPassUpdates(p:Byte ptr)
	
	' GpuProgramParameters
	Function o_gpu_setNamedConstant(pars:Byte ptr, cname:Byte ptr, v:Float)
	
	' Ray
	Function o_ray_Create:Byte ptr(origin:Byte ptr, direction:Byte ptr)

	' Framelistener
	Function o_createFrameListener:Byte ptr()
	Function o_defineFrameStarted(func:Int, listener:Byte ptr)
	Function o_defineFrameEnded(func:Int, listener:Byte ptr)

	' CompositorInstance
	Function o_createCIListener:Byte ptr()
	Function o_ci_addListener(instance:Byte ptr, listener:Byte ptr)
	
	' CompositorInstanceListener
	Function o_createMaterialListener:Byte ptr()
	Function o_setMaterialSetupPtr(matListener:Byte ptr, func:Int)
	Function o_setMaterialRenderPtr(matListener:Byte ptr, func:Int)
End Extern
?

Include "include/colour.bmx"
Include "include/axisalignedbox.bmx"
Include "include/root.bmx"
Include "include/logmanager.bmx"
Include "include/resourcegroupmanager.bmx"
Include "include/materialmanager.bmx"
Include "include/material.bmx"
Include "include/technique.bmx"
Include "include/texture.bmx"
Include "include/renderwindow.bmx"
Include "include/rendersystem.bmx"
Include "include/scenemanager.bmx"
Include "include/viewport.bmx"
Include "include/camera.bmx"
Include "include/entity.bmx"
Include "include/mesh.bmx"
Include "include/scenenode.bmx"
Include "include/light.bmx"
Include "include/compositormanager.bmx"
Include "include/pass.bmx"
Include "include/gpuprogramparameters.bmx"
Include "include/Ray.bmx"
Include "include/RaySceneQuery.bmx"
Include "include/framelistener.bmx"
Include "include/CompositorInstanceListener.bmx"
Include "include/CompositorInstance.bmx"
